package com.stu.exercise.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.stu.exercise.entity.Orders;
import com.stu.exercise.entity.R;
import com.stu.exercise.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/orders")
public class OrdersController {

    @Autowired
    private OrdersService ordersService;

    @RequestMapping("/list")
    public R list(@RequestBody Map<String, Object> map){
        return ordersService.getOrders(map);
    }

    @RequestMapping("/edit")
    public R edit(@RequestBody Orders orders){
        boolean update = ordersService.updateById(orders);
        if (update){
            return R.success("修改成功", null);
        }
        return R.error(500, "修改失败");
    }

}
